import service from "@/utils/request"

import LoginWork from "@/utils/LoginWork" 

// 补料开单作业数据获取
export interface ReplenishmentBillParms{
    endslipDate:string,
    lotNo:string,
    pageNum:number,
    pageSize:number,
    slipNo:string,
    startslipDate:string,
   
}

export interface ReplenishmentBillInterfacE{
    dtos:dtos[],
    total?:number
}

export interface dtos{
    slipNo: string,
    slipDate: string,
    dutyDeptName: string,
    prnFlag: null,
    cfmFlag: null,
    financeFlag: null,
    blFlag: null,
    dutyMemo: null,
    returnRek: null,
    total?:number,
}

export const ReplenishmentBill = (parms:ReplenishmentBillParms) => {
    return service.put<any,ReplenishmentBillInterfacE>('/pcFactorStockQuery/getSpHeadQuery',parms)
}

// 备注说明
export const Descr = (slipNo:string,remark:string) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spRemakrUpdate?slipNo=${slipNo}&remark=${remark}`)
}

// 补制明细进度查询
export interface  MakeUpDetailedProgressInterface{
    numberDetail: [],
    mtl: any[],
    detail: detail[]
}

export interface detail{
    lotNo: string,
    style: null | string | number,
    ordQty: null | string | number,
    partName: string,
    segment: number,
    totalQty: null | string | number,
    percent: null | string | number,
    mtlNo: string,
    size1: number,
    size2: number,
    cutNum: null | string | number,
    lqty5: null | string | number,
    rqty5: null | string | number,
    lqty6: null | string | number,
    rqty6: null | string | number,
    musage: null | string | number,
    lqty17: null | string | number,
    rqty17: null | string | number,
    lqty18: null | string | number,
    rqty18: null | string | number,
    lqty13: null | string | number,
    rqty13: null | string | number,
    lqty14: null | string | number,
    rqty14: null | string | number,
    lqty19: null | string | number,
    rqty19: null | string | number,
    lqty20: null | string | number,
    rqty20: null | string | number,
    lqty3: null | string | number,
    rqty3: null | string | number,
    lqty4: null | string | number,
    rqty4: null | string | number,
    lqty11: null | string | number,
    rqty11: null | string | number,
    lqty12: null | string | number,
    rqty12: null | string | number,
    lqty9: null | string | number,
    rqty9: null | string | number,
    lqty10: null | string | number,
    rqty10: null | string | number,
    lqty1: null | string | number,
    rqty1: null | string | number,
    lqty2: null | string | number,
    rqty2: null | string | number,
    lqty15: null | string | number,
    rqty15: null | string | number,
    lqty16: null | string | number,
    rqty16: null | string | number,
    lqty7: null | string | number,
    rqty7: null | string | number,
    lqty8: null | string | number,
    rqty8: null | string | number,
    seqNo?:string,
    color?:string
}

export const MakeUpDetailedProgress = (slipNo:string) => {
    return service.post<any,MakeUpDetailedProgressInterface>(`/pcFactorStockQuery/getSpDetailQery?slipNo=${slipNo}`)
}


// 补料部位查询
export interface FeedPartQueryInterface{
    size: size[],
    slipDept: slipDept[],
    dtos: dtos[],
    slipType: []
}

export interface size {
    size: string,
    orderQty: number
}
export interface slipDept{
    deptName: string,
    deptNo: string
}

export interface dtos {
    seqNo: number,
    partName: string,
    segment: number,
    mtlName: string,
    mtlUnit: string,
    mtlColor: string,
    size1: number,
    size2: number,
    mtlNo: string
}


export const FeedPartQuery = (lotNo:string) => {
    return service.post<any,FeedPartQueryInterface>(`/pcFactorStockQuery/getSpPartQuery?lotNo=${lotNo}`)
}

export const FeedPartQuery1 = () => {
    return service.post<any,any>(`/pcFactorStockQuery/complement/dept/combo?searchKey=${''}`)
}

// 开补子材料查询
export interface OpenTheFillerMaterialParms{
    lotNo:string,
    mtlNo:string,
    partName:string,
    segment:number,
    sysUser:string
}

export const OpenTheFillerMaterial = (parms:OpenTheFillerMaterialParms) => {
    return service.put<any,any>('/pcFactorStockQuery/getSpPartSubQuery',parms)
}

// 新增追加补料部位
interface date{
    code:number,
    data:string,
    message:string
}

export interface AddedAnAdditionalComplementParms{
    blFlag:string,
    lotNo:string,
    seqNo:string[],
    size:string[],
    slipDeptName:string,
    slipDeptNo:string,
    slipNo:string
}

export const AddedAnAdditionalComplement = (parms:AddedAnAdditionalComplementParms) => {
    return LoginWork.put<any,date>('/pcFactorStockQuery/spPartAdd',parms)
}

// 补料部位追加查询
export const PartOfTheMaterialAdded = (lotNo:string,slipNo:string) => {
    return service.post<any,any>(`/pcFactorStockQuery/getSpPartAppQuery?lotNo=${lotNo}&slipNo=${slipNo}`)
}

// 计算补料明细
export const CalculateFeedDetails = (slipNo:string,sizeNum:number) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spDetailAdd?slipNo=${slipNo}&sizeNum=${sizeNum}`)
}

// 补量复制
export interface ComplementaryReplicationParms{
    lotNo:string,
    partName:string,
    segment:number,
    slipNo:string,
}

export const ComplementaryReplication = (parms:ComplementaryReplicationParms) => {
    return LoginWork.put<any,date>('/pcFactorStockQuery/spDetailCopyUpdate',parms)
}

// 员工信息
export interface InformationOfEmployeesParms{
    pageNum:number,
    pageSize:number
}

export interface InformationOfEmployeesInterface{
    dtos:dataList[]
    total?:number
}

export interface dataList{
    deptName: string,
    name: string,
    workType: string,
    position: string
}

export const InformationOfEmployees = (parms:InformationOfEmployeesParms,deptName:string,name:string) => {
    if(deptName === undefined){
        deptName = ''
    }
    return service.put<any,InformationOfEmployeesInterface>(`/back/getEmployee?deptName=${deptName}&name=${name}`,parms)
}

// 责任建档
export interface ResponsibilityDocumentationInterface{
    deptName: string,
    deptNo: string,
    name: string,
    idNo: string,
    qty: string
}

export const ResponsibilityDocumentation = (type:number) => {
    return service.post<any,ResponsibilityDocumentationInterface[]>(`/pcFactorStockQuery/getDutyFileQuery?type=${type}`)
}

// 责任建档新增插入
export const ResponsibilityProfileNewInsert = (type:number,parms:any) => {
    return LoginWork.put<any,date>(`/pcFactorStockQuery/getDutyFileAdd?type=${type}`,parms)
}

// 平均分摊
export const shareAlike = (size:number) => {
    return service.post<any,any>(`/pcFactorStockQuery/parentComputer?type=${size}`,)
}

// 打印补料单
export const printInBills = (slipNo:number) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spPrintUpdate?slipNo=${slipNo}`)
}

// 整单删除
export const CompleteOrder = (slipNo:string) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spAllDelete?slipNo=${slipNo}`)
}

// 转审核
export const TransferReview = (slipNo:string) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spTurnCfmUpdate?slipNo=${slipNo}`)
}

// 转审核
export const TransferReview1 = (slipNo:string,) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spTurnCfmUpdate?slipNo=${slipNo}&type=${0}`)
}

// 厂商数据
export interface VendorDatadParms{
    pageNum:number,
    pageSize:number
}

export interface VendorDatadParmsInterface{
    dtos:dtosDateTableList[],
    total?:number
}

export interface dtosDateTableList{
    vendorNo: string,
    vendorName: string
}

export const VendorDataList = (parms:VendorDatadParms,vendorNo:string,vendorName:string) => {
    return service.put<any,VendorDatadParmsInterface>(`/back/getVendorQuery?vendorNo=${vendorNo}&vendorName=${vendorName}`,parms)
}

// 部门全部查询
export const DepartmentAllInquiry = () => {
    return service.post<any,any>(`/back/getStcColQuery`)
}

// 客人号大底号查询
export const GuestNumberDrinkBigBottomNumberInquiry = (slipNo:string,lotNo:string,style:string) => {
    return service.post<any,any>(`/pcFactorStockQuery/getNumberQery?slipNo=${slipNo}&lotNo=${lotNo}&style=${style}`)
}

// 指令责任明细查询
export const InstructionDetail = (slipNo:string,mtlNo:string) => {
    return LoginWork.post<any,any>(`/pcFactorStockQuery/getSpDutyLotQuery?slipNo=${slipNo}&mtlNo=${mtlNo}`)
}

// 补料类型修改
export const FeedTypeModified = (slipNo:string,slipType:string) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/spHeadUpdate?slipNo=${slipNo}&slipType=${slipType}`)
}

// 责任建档新增
export interface ResponsibilityProfileAddedPamrs{
    companyId:string,
    dutyDetail:string,
    mtlNo:string,
    slipNo:string
}

export const ResponsibilityProfileAdded = (qty:number,parms:any) => {
    return LoginWork.put<any,date>(`/pcFactorStockQuery/dutyFileAdd?qty=${qty}&type=${parms.type}&flag=${parms.flag}`,parms)
}

// 补制补料明细删除
export const SupplementaryMaterialDetailsDeleted = (slipNo:string,lotNo:string,seqNo:string) => {
    return LoginWork.post<any,date>(`/pcFactorStockQuery/getSpDetailDelete?slipNo=${slipNo}&lotNo=${lotNo}&seqNo=${seqNo}`)
}
//   明细删除
export interface TheAttributionDetailsAreDeletedParms{
    deptNo:string,
    dutyName:string,
    dutyQty:number,
    idNo:string,
    mtlNo:string,
    slipNo:string,
}

export const TheAttributionDetailsAreDeleted = (parms:TheAttributionDetailsAreDeletedParms) => {
    return LoginWork.put<any,date>(`/pcFactorStockQuery/dutyDetailDelete`,parms)
}

// 责任建档删除 -> 员工删除
export interface EmployeeDeletionParms{
    deptName:string,
    deptNo:string,
    dutyQty:number,
    idNo:string,
    name:string
}

export const  EmployeeDeletion = (type:number,parms:EmployeeDeletionParms) => {
    return LoginWork.put<any,date>(`/pcFactorStockQuery/dutyFileDelete?type=${type}`,parms)
}

export const VendorData = (parms:any) => {
    return service.put<any,any>(`/back/getVendorSearch?search=${''}`,parms)
}

// 责任人清空
export const ResponsibilityClear = (slipNo:string) => {
    return LoginWork.get<any,date>(`/pcFactorStockQuery/dutyDetail/Clear?type=${slipNo}`)
}